/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bl;

import dal.ConnectDatabase;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 *
 * @author Sony
 */
public class SalaryReportBO {

    Connection connect = ConnectDatabase.getConnection();

    public ResultSet showSalary(Date dateFrom, Date dateTo) {
        String sql = "select [LaborID], SUM (SalaryDaily)as Total from Attendance where [Day] between ? and ? group by LaborID order by Total";
        ResultSet rs = null;
        try {
            PreparedStatement pstm = connect.prepareStatement(sql);
            pstm.setDate(1, dateFrom);
            pstm.setDate(2, dateTo);
            rs = pstm.executeQuery();
            return rs;
        } catch (Exception ex) {
            return rs;
        }

    }
}
